package Task2;

public class TestJSON {
    public static void main(String[] args) {
        Space bj = new Space(1, "北京");
        String jsonStr = ObjectMapper.toJSON(bj);
        System.out.println(jsonStr);
        String jsonStr2 = "{\"id\":2,\"name\":\"上海\"}";
        // 反射，Space.class其实就是用将来的“注入”
        Space sh = ObjectMapper.fromJSON(jsonStr2, Space.class);
        System.out.println(sh);
    }
}
